home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / O Boy / Source / AETE_da.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-21  |  4.5 KB  |  249 lines  |  [TEXT/R*ch]

  1. #pragma once on
  2. /*
  3.     AETE_da.h
  4.     © Bob Boylan 1996
  5.  
  6.     Revision History
  7.     MacHack 1996    initial creation
  8. */
  9. #include "BaseTypes.h"
  10. #include "Clone_ut.h"
  11. #include "UAppleEventsMgr.h"
  12.  
  13. #include <vector.h>
  14. #include <string>
  15.  
  16.  
  17.  
  18.  
  19.  
  20. //    -----------------------------------------------------------------
  21. //    Elem_da 
  22. //
  23. class Elem_da
  24. {
  25. public:
  26.     // data
  27.         DescType    _ID;        
  28.  
  29.     // i/o
  30.         friend istream&    operator >> (istream &ioStream, Elem_da& outElem);
  31.  
  32. };
  33.  
  34. //    -----------------------------------------------------------------
  35. //    Prop_da 
  36. //
  37. class Prop_da
  38. {
  39. public:
  40.         Prop_da ( DescType inKind = typeNull )
  41.         {
  42.             _ID = inKind;
  43.         }
  44.     // data
  45.         string         _Name;
  46.         DescType    _ID;
  47.         DescType    _Class;
  48.         
  49.     // i/o
  50.         friend istream&    operator >> (istream &ioStream, Prop_da& outProp);
  51.  
  52.     // comparison
  53.         Boolean operator == ( const Prop_da & inOther ) const
  54.         {
  55.             return _ID == inOther._ID ;
  56.         }
  57.  
  58. };
  59.  
  60. //    -----------------------------------------------------------------
  61. //     Class_da
  62. //
  63. class Class_da
  64. {
  65. public:
  66.     // data
  67.         string             _Name;
  68.         DescType        _ID;
  69.         vector<Prop_da>    _Props;
  70.         vector<Elem_da>    _Elems;
  71.         
  72.     // i/o
  73.         friend istream&    operator >> (istream &ioStream, Class_da& outClass);
  74.     
  75.     // comparison
  76.         Boolean operator == ( const Class_da & inOther ) const
  77.         {
  78.             return _ID == inOther._ID ;
  79.         }
  80. };
  81.  
  82. //    -----------------------------------------------------------------
  83. //    ComparisonOp_da
  84. //
  85. class ComparisonOp_da
  86. {
  87. public:
  88. // i/o
  89.         friend istream&    operator >> (istream &ioStream, ComparisonOp_da& outComparison);
  90. };
  91.  
  92. //    -----------------------------------------------------------------
  93. //     EnumValue_da
  94. //
  95. class EnumValue_da
  96. {
  97. public:
  98.     // data
  99.         string        _Name;
  100.         DescType    _ID;
  101.  
  102.     // i/o
  103.         friend istream&    operator >> (istream &ioStream, EnumValue_da& outEnumValue);
  104.  
  105.     // comparison
  106.         Boolean operator == ( const EnumValue_da & inOther ) const
  107.         {
  108.             return _ID == inOther._ID ;
  109.         }
  110.         Boolean operator < ( const EnumValue_da & inOther ) const
  111.         {
  112.             return _ID < inOther._ID ;
  113.         }
  114.  
  115. };
  116. //    -----------------------------------------------------------------
  117. //     Enum_da
  118. //
  119. class Enum_da
  120. {
  121. public:
  122.     // data
  123.         DescType                _ID;
  124.         vector<EnumValue_da>    _Values;
  125.  
  126.     // i/o
  127.         friend istream&    operator >> (istream &ioStream, Enum_da& outEnum);
  128.     
  129.     // comparison
  130.         Boolean operator == ( const Enum_da & inOther ) const
  131.         {
  132.             return _ID == inOther._ID ;
  133.         }
  134.  
  135. };
  136. //    -----------------------------------------------------------------
  137. //     EventParam_da
  138. //
  139. class EventParam_da
  140. {
  141. public:
  142.     // data
  143.         string _Name;
  144.  
  145.     // i/o    
  146.         friend istream&    operator >> (istream &ioStream, EventParam_da& outEventParam);
  147. };
  148.  
  149. //    -----------------------------------------------------------------
  150. //     Event_da
  151. //
  152. class Event_da
  153. {
  154. public:
  155.     // data
  156.         string _Name;
  157.         vector<EventParam_da>    _Params;
  158.  
  159.     // i/o
  160.         friend istream&    operator >> (istream &ioStream, Event_da& outEvent);
  161.  
  162. };
  163.  
  164. //    -----------------------------------------------------------------
  165. //     Suite_da
  166. //
  167. class Suite_da
  168. {
  169. public:
  170.     // data
  171.         string _Name;
  172.         vector< Event_da >            _Events;
  173.         vector< Class_da >            _Classes;
  174.         vector< ComparisonOp_da >    _CompOps;
  175.         vector< Enum_da >            _Enums;
  176.  
  177.     // i/o
  178.         friend istream&    operator >> (istream &ioStream, Suite_da& outSuite);
  179. };
  180.  
  181. class AppAEObj_pd;    // fwd
  182.  
  183.  
  184.  
  185.  
  186.  
  187. // --------------------------------------------------------------------------------------
  188. class AETE_da 
  189. {
  190. public:
  191.     // ctor,dtor
  192.                 AETE_da();
  193.                 AETE_da( AppAEObj_pd *inApp );
  194.         virtual    ~AETE_da();
  195.     
  196.     // access
  197.         virtual
  198.         vector<Prop_da>     GetProperties( const DescType inClassID );
  199.         virtual
  200.         vector<Elem_da>     GetElements( const DescType inClassID );
  201.         
  202.         virtual
  203.         string            GetEnumName( const DescType inEnumValue );
  204.         
  205.         virtual
  206.         string            GetClassName( const DescType inClassID );
  207.     
  208.     // helper class for iterating
  209.         class ClassIterator_ut
  210.         {
  211.         public:
  212.             // ctor
  213.                 ClassIterator_ut() : _SuitesP( nil ) {}
  214.                 ClassIterator_ut( vector<Suite_da> * inSuites, Boolean inPointToEnd = false );
  215.             // op for comparing
  216.                 Boolean operator !=( const ClassIterator_ut & inOther );
  217.         
  218.             // op for pre increment
  219.                 ClassIterator_ut        operator ++();
  220.             
  221.             // access
  222.                 Class_da & operator *();
  223.             
  224.         private:
  225.             // data
  226.                 Int_32    _SuiteIndex, _ClassIndex;
  227.                 vector<Suite_da> *_SuitesP;
  228.         };
  229.  
  230. protected:
  231.  
  232.     // manipulation of internal data
  233.         virtual
  234.         Clone_ut<StAEDescriptor> RetrieveFromApp( AppAEObj_pd *inApp );
  235.         virtual
  236.         void        IncorpAETE(  Handle inAETEHandle );
  237.  
  238.     // data
  239.         vector<Suite_da>        _Suites;
  240.         vector<EnumValue_da>    _EnumMap;
  241.  
  242. private:
  243.     // private data
  244.         ClassIterator_ut    _LastClass; 
  245.         AECoercePtrUPP        _EnumHandlerUPP;
  246.         AECoercePtrUPP        _BooleanHandlerUPP;
  247.  
  248. };
  249.